<%--
  Created by IntelliJ IDEA.
  User: GSM
  Date: 2023/10/23
  Time: 16:11
  To change this template use File | Settings | File Templates.
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <title>连续和</title>
    </head>
    <body bgcolor="cyan">
        <h3>这是一个简单的JSP页面</h3>
        <h4>1到100的连续和是：<%= calculateSum() %></h4>

        <%!
            int calculateSum() {
                int sum = 0;
                for (int i = 1; i <= 100; i++) {
                    sum += i;
                }
                return sum;
            }
        %>
    </body>
</html>

